package com.xnyzc.lhy.nio.feign.amap;

import com.xnyzc.lhy.nio.feign.fallback.amap.AmapServiceFallback;
import com.xnyzc.lhy.resource.entity.amap.AmapGouldHistoryGps;
import com.xnyzc.lhy.resource.entity.amap.AmapGouldResult;
import com.xnyzc.lhy.resource.entity.amap.AmapGpsIdParam;
import com.xnyzc.lhy.resource.entity.amap.AmapHistoryGpsParam;
import com.xnyzc.lhy.resource.entity.amap.AmapTidParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@FeignClient(name = "${feign.applicationName.resource}", fallback = AmapServiceFallback.class)
public interface IAmapService {


    /**
     * 获取猎鹰服务终端ID
     */
    @PostMapping("/amap/getAmapTid")
    Long getAmapTid(@RequestBody AmapTidParam param);

    /**
     * 获猎鹰服务轨迹ID
     *
     * @param param
     * @return
     */
    @PostMapping("/amap/getAmapGpdId")
    Long getAmapGpdId(@RequestBody AmapGpsIdParam param);

    /**
     * 获取两点之间的距离
     *
     * @param startLng 开始经度
     * @param startLat 开始纬度
     * @param endLng   结束经度
     * @param endLat   结束纬度
     * @return
     */
    @GetMapping("/amap/getDistance")
    Double getDistance(@RequestParam("startLng") String startLng, @RequestParam("startLat") String startLat, @RequestParam("endLng") String endLng, @RequestParam("endLat") String endLat);

    /**
     * 获取两个点之间的距离与时间(文字版)
     *
     * @param startPoint 开始点位
     * @param endPoint   结束点位
     * @return
     */
    @GetMapping("/amap/getDistanceAndDuration")
    HashMap<String, String> getDistanceAndDuration(@RequestParam("startPoint") String startPoint, @RequestParam("endPoint") String endPoint);

    /**
     * 获取两个点之间的距离与时间(数字版)
     *
     * @param startPoint 开始点位
     * @param endPoint   结束点位
     * @return
     */
    @GetMapping("/amap/getStrategy")
    Map<String, Integer> getStrategy(@RequestParam("startPoint") String startPoint, @RequestParam("endPoint") String endPoint);

    /**
     * 根据开始与结束时间获取轨迹信息
     *
     * @param param
     * @return
     */
    @PostMapping("/amap/getHistoryGps")
    AmapGouldHistoryGps getHistoryGps(@RequestBody AmapHistoryGpsParam param);

    /**
     * 获取两个点位之间的距离,返回距离实体类
     *
     * @param startPoint 开始点位
     * @param endPoint   结束点位
     * @return
     */
    @GetMapping("/amap/getDistancePoint")
    AmapGouldResult getDistancePoint(@RequestParam("startPoint") String startPoint, @RequestParam("endPoint") String endPoint);
}
